package com.woniu.core.util;

public class RedisKeyUtil {

        //手机号注册业务验证码key
        public static String sendRegisterCodeKey(String phone) throws Exception{
            return "registercode:phone:"+phone;
        }
    //手机号验证码一分钟发送标识
    public static String sendRegisterCodeInMinute(String phone) throws Exception{
        return "register:code:minute:phone:"+phone;
    }

    //手机号验证码24小时5次
    public static String sendCodeNumberOn24hour(String phone) throws Exception{
        return "code:number:24hour:phone:"+phone;
    }

    //手机号验证输入错误次数
    public static String errorTotal(String phone) throws Exception{
        return "code:error:5:phone:"+phone;
    }

    //用户关注场馆教练列表的key
    public static String followList(Integer userId) throws Exception{
        return "follow:list:userid:"+userId;
    }
    //场馆教练的粉丝
    public static String userFollowListKey(Integer coachId)throws Exception{
        return "follow:coachInfoid:"+coachId;
    }
    //关注场馆教练的粉丝数量
    public static String followNumListKey()throws Exception{
        return "follow:num:coachInfoid:";
    }

    public static String sendLoginCodeKey(String phone) {
        return "login:code:phone:"+phone;
    }

    public static String sendLoginCodeInMinute(String phone) {
        return "login:code:minute:phone:"+phone;
    }


    //购物车的第一个redis的key：大key
    public static String shoppingList(Integer userId) {
        return "shopping:userid:"+userId;
    }
    //购物车的第2个hashimap的key:小key
    public static String shoppingDetail(Integer userId,Integer bookId) {
        return "shopping:detail:userid:"+userId+"bookid:"+bookId;
    }

    //缓存
    public static String cacheBookTypeTree() {
        return "cache:booktype:tree";
    }
    //   图书类别树形数据缓存
    public static String CACHE_BOOK_TYPE_TREE="cache:booktype:tree";
    //分布式锁
    public static String lockPhone(String phone) throws Exception{
            return "lock:phone:"+phone;
        }
    public static String lockUser(String userName) throws Exception{
        return "lock:username:"+userName;
    }
    //购物车书的锁：商品id锁 锁住了防止超卖问题
    public static String lockBookId(Integer bookId) throws Exception{
        return "lock:bookid:"+bookId;
    }
    //存入订单的支付时间
    public static String orderPayTime(String orderNum) throws Exception{
        return "pay:time:orderNum:"+orderNum;
    }

    //上架电影的key
    public static String movieStatusKey(Integer movieId) throws Exception{
        return "movie:status:movieid:"+movieId;
    }
    public static String movieStatusKeyUp(Integer movieId) throws Exception{
        return "movie:status:up:movieid:"+movieId;
    }

    //购买时的座位加锁
    public static String lockseatId(Integer seatId) {
        return "order:ticket:buy:seatId:"+seatId;
    }
}
